<template>
    <div>
        <h1>门店列表显示</h1>

        店长名:
        <input type="text" v-model="datas.name">

        成立日期:
        <input type="date" v-model="datas.time">

        所在地区:
        <select v-model="datas.dq">
            <option value="0">请选择</option>
            <option v-for="a in sdatas":value="a.hoteId">{{a.hoteAddress}}</option>
        </select>

        <input type="button" value="查询" @click="list">

        <table class="table">
            <thead>
            <tr>
                <td>门店名</td>
                <td>所在地区</td>
                <td>门店店名</td>
                <td>店长手机号</td>
                <td>门店成立日期</td>
                <td>同时接待最大人数</td>
                <td>门店状态</td>
                <td>记录录入日期</td>
                <td>是否已开业</td>
            </tr>
        </thead>
        <tbody>
                <tr v-for="a in data">
                <td>{{a.userName}}</td>
                <td>{{a.hoteAddress}}</td>
                <td>{{a.userDian}}</td>
                <td>{{a.userPhone}}</td>
                <td>{{moment(a.userTime).format("yyyy年MM月DD日 HH时mm分ss秒")}}</td>
                <td>{{a.userZuida}}</td>
                <td>{{a.userZhuang==1?'休息':a.userZhuang==2?'营业':'歇业'}}</td>
                <td>{{a.userTimes}}</td>
                <td>
                    <span v-if="a.userTime<=a.userTimes">已开业</span>
                </td>
                </tr>
        </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import moment from 'moment';
import { ref ,onMounted } from 'vue';
import { useRoute } from 'vue-router';


const router = useRoute();
///查询
const datas =ref({
    name:'',
    time:'',
    dq:''
})

const data = ref([
    {
    "userId": 2,
    "hoteId": 1,
    "userName": "张三",
    "hoteAddress": "月之国",
    "userDian": "聚友烧烤",
    "userPhone": "12345678",
    "userTime": "2025-05-20T00:00:00",
    "userZuida": 10,
    "userZhuang": 1,
    "userTimes": "2025-05-26T00:00:00",
    "userKaiye": 1
  },
]);

onMounted(()=>{
list()
xiala()
})

///下拉
const sdatas=ref([
      {
    "hoteId": 0,
    "hoteAddress": ""
  },
])
///下拉
const xiala=()=>{
    axios.get("/api/Xiala/Xiala").then(res=>{
       sdatas.value = res.data
    })
}
///显示
const list=()=>{
    axios.get("/api/USer/GetAllAsync",{params:datas.value}).then(res=>{
         data.value = res.data
    })
}


</script>

<style scoped>

</style>